home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 25 / CU Amiga Magazine's Super CD-ROM 25 (1998)(EMAP Images)(GB)(Track 1 of 2)[!][issue 1998-08].iso / CUCD / Programming / QuakeTools / src / libqtools / memory.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-05-29  |  5.0 KB  |  156 lines

  1. #ifndef    MEMORY_H
  2. #define    MEMORY_H
  3. /*
  4.  * ============================================================================
  5.  * structures
  6.  * ============================================================================
  7.  */
  8.  
  9. /* key / value pair sizes */
  10. #define    MAX_KEY            32
  11. #define    MAX_VALUE        1024
  12.  
  13. #define    MAX_MAP_MODELS        256
  14. #define    MAX_MAP_ENTSTRING    65536
  15. #define    MAX_MAP_PLANES        8192    //    8192
  16. #define    MAX_MAP_NODES        9216    //   32767    // because negative shorts are contents
  17. #define    MAX_MAP_CLIPNODES    24576    //   32767    //
  18. #define    MAX_MAP_LEAFS        6144    //   32767    //
  19. #define    MAX_MAP_VERTS        23552    //   65535
  20. #define    MAX_MAP_FACES        18432    //   65535
  21. #define    MAX_MAP_MARKSURFACES    23552    //   65535
  22. #define    MAX_MAP_TEXINFO        1024    //    4096
  23. #define    MAX_MAP_EDGES        43008    //  256000
  24. #define    MAX_MAP_SURFEDGES    82944    //  512000
  25. #define    MAX_MAP_TEXTURES    0x200000
  26. #define    MAX_MAP_LIGHTING    614400    //0x100000
  27. #define    MAX_MAP_VISIBILITY    163840    //0x100000
  28.  
  29. #define CLUSTER_MODELS        32
  30. #define CLUSTER_ENTSTRING    8192
  31. #define CLUSTER_PLANES        512    //1024
  32. #define CLUSTER_NODES        1024    //4096
  33. #define CLUSTER_CLIPNODES    1024    //4096
  34. #define CLUSTER_LEAFS        1024    //2048
  35. #define CLUSTER_VERTS        2048    //8192
  36. #define CLUSTER_FACES        1024    //4096
  37. #define CLUSTER_MARKSURFACES    512    //892
  38. #define CLUSTER_TEXINFO        512
  39. #define CLUSTER_EDGES        4096    //16384
  40. #define CLUSTER_SURFEDGES    4096    //16384
  41. #define CLUSTER_TEXTURES    65536
  42. #define CLUSTER_LIGHTING    65536
  43. #define CLUSTER_VISIBILITY    32768
  44.  
  45. #define    LUMP_ENTITIES        (1<<0)
  46. #define    LUMP_PLANES        (1<<1)
  47. #define    LUMP_TEXTURES        (1<<2)
  48. #define    LUMP_VERTEXES        (1<<3)
  49. #define    LUMP_VISIBILITY        (1<<4)
  50. #define    LUMP_NODES        (1<<5)
  51. #define    LUMP_TEXINFO        (1<<6)
  52. #define    LUMP_FACES        (1<<7)
  53. #define    LUMP_LIGHTING        (1<<8)
  54. #define    LUMP_CLIPNODES        (1<<9)
  55. #define    LUMP_LEAFS        (1<<10)
  56. #define    LUMP_MARKSURFACES    (1<<11)
  57. #define    LUMP_EDGES        (1<<12)
  58. #define    LUMP_SURFEDGES        (1<<13)
  59. #define    LUMP_MODELS        (1<<14)
  60.  
  61. #define    ALL_LUMPS        (1<<15)-1
  62.  
  63. /*
  64.  * ============================================================================
  65.  */
  66.  
  67. #define    MAX_MAP_ENTITIES    1024
  68. #define    MAX_MAP_TEXSTRINGS    MAX_MAP_TEXINFO
  69. #define    MAX_MAP_BRUSHFACES    MAX_MAP_FACES
  70. #define    MAX_MAP_BRUSHPLANES    MAX_MAP_PLANES
  71.  
  72. #define    CLUSTER_ENTITIES    128
  73. #define    CLUSTER_TEXSTRINGS    CLUSTER_TEXINFO
  74. #define    CLUSTER_BRUSHFACES    CLUSTER_FACES
  75. #define    CLUSTER_BRUSHPLANES    CLUSTER_PLANES
  76.  
  77. #define    MAP_ENTITIES        (1<<15)
  78. #define    MAP_TEXSTRINGS        (1<<16)
  79. #define    MAP_BRUSHPLANES        (1<<17)
  80. #define    MAP_BRUSHFACES              (1<<18)
  81.  
  82. #define    ALL_MAPS        (((1<<19)-1)-((1<<15)-1))
  83.  
  84. struct memory {
  85.   int availHeaders;
  86.   unsigned char mapOptions, bspOptions, litOptions, visOptions;
  87.   
  88.   /* standard bsp */
  89.   int entdatasize,    max_entdatasize;    char *dentdata;
  90.   int numplanes,    max_numplanes;        struct dplane_t *dplanes;
  91.   int texdatasize,    max_texdatasize;    unsigned char *dtexdata;
  92.   int numvertexes,    max_numvertexes;    struct dvertex_t *dvertexes;
  93.   int visdatasize,    max_visdatasize;    unsigned char *dvisdata;
  94.   int numnodes,        max_numnodes;        struct dnode_t *dnodes;
  95.   int numtexinfo,    max_numtexinfo;        struct texinfo *texinfo;
  96.   int numfaces,        max_numfaces;        struct dface_t *dfaces;
  97.   int lightdatasize,    max_lightdatasize;    unsigned char *dlightdata;
  98.   int numclipnodes,    max_numclipnodes;    struct dclipnode_t *dclipnodes;
  99.   int numleafs,        max_numleafs;        struct dleaf_t *dleafs;
  100.   int nummarksurfaces,    max_nummarksurfaces;    unsigned short int *dmarksurfaces;
  101.   int numedges,        max_numedges;        struct dedge_t *dedges;
  102.   int numsurfedges,    max_numsurfedges;    int *dsurfedges;
  103.   int nummodels,    max_nummodels;        struct dmodel_t *dmodels;
  104.   
  105.   /* extras for maps */
  106.   int nummapentities,    max_nummapentities;    struct entity *mapentities;
  107.   int nummaptexstrings,    max_nummaptexstrings;    char **maptexstrings;
  108.   int numbrushfaces,    max_numbrushfaces;    struct mface *brushfaces;
  109.   int numbrushplanes,    max_numbrushplanes;    struct plane *brushplanes;
  110.   
  111.   /* extras */
  112.                           struct visfacet **edgefaces[2];
  113.  
  114.   /* extras for light */
  115.   
  116.   /* extras for vis */
  117.   
  118.   /* configureable maximums */
  119. #ifndef    CUSTOM_MAXIMA
  120. # define    MAXEDGES        32    //64    //32
  121. # define    MAXPOINTS        28    //56    //28                   // don't let a base face get past this
  122.                                         // because it can be split more later
  123. # define    MAX_EDGES_IN_REGION    32
  124. # define    MAX_PORTALS        32768
  125. # define    MAX_PORTALS_ON_LEAF    128
  126. #else
  127. # define    DEFEDGES        32
  128. # define    DEFPOINTS        28
  129. # define    DEF_EDGES_IN_REGION    32
  130. # define    DEF_PORTALS        32768
  131. # define    DEF_PORTALS_ON_LEAF    128
  132. # define    MAXPOINTS        bspMem->maxpoints
  133. # define    MAXEDGES        bspMem->maxedges
  134. # define    MAX_EDGES_IN_REGION    bspMem->maxedges_in_region
  135. # define    MAX_PORTALS        bspMem->maxportals
  136. # define    MAX_PORTALS_ON_LEAF    bspMem->maxportals_on_leaf
  137.   int maxpoints;
  138.   int maxedges;
  139.   int maxedges_in_region;
  140.   int maxportals;
  141.   int maxportals_on_leaf;
  142. #endif
  143. } __packed;
  144.  
  145. /*
  146.  * ============================================================================
  147.  * prototypes
  148.  * ============================================================================
  149.  */
  150.  
  151. void PrintClusters(__memBase, int printType, bool toDisk);
  152. void AllocClusters(__memBase, int allocType);
  153. void ExpandClusters(__memBase, int allocType);
  154. void FreeClusters(__memBase, int freeType);
  155. #endif
  156.